﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Pb;

public class Cards : MonoBehaviour
{

    public List<UISprite> cardsSprites;
    public UILabel cardsTypeLabel;
    //public UISprite result;

    public Vector3 destination;

    void Start()
    {
        if (destination == new Vector3(81, 308, 0))
        {
            gameObject.transform.Find("Cards1").transform.localScale *= 0.8f;
            gameObject.transform.Find("Cards2").transform.localScale *= 0.8f;
            gameObject.AddComponent<UIGrid>();
            gameObject.GetComponent<UIGrid>().cellWidth = 44f;
            gameObject.GetComponent<UIGrid>().enabled = true;
        }
    }

    void Update()
    {
        transform.localPosition = Vector3.MoveTowards(transform.localPosition, destination, 20);
    }

    /// <summary>
    /// 展示牌
    /// </summary>
    /// <param name="cards"></param>
    /// <param name="cardsType"></param>
    public void ShowCards(List<PaiCard> cards, string cardsType)
    {
        for (int i = 0; i < cardsSprites.Count; i++)
        {
            cardsSprites[i].spriteName = cards[i].Id.ToString();
        }
        cardsTypeLabel.text = cardsType;
        cardsTypeLabel.gameObject.SetActive(true);
    }
}
